#!/usr/bin/python3
# coding=utf-8
#
# Copyright (C) 2023-2024. Huawei Technologies Co., Ltd. All rights reserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# ===============================================================================

import numpy as np
import torch

def gen_golden_data_simple():
    # 行向量测试
    input_x = np.random.uniform(1, 2, [8, 256]).astype(np.float16)
    dim = 0
    p = 3.0
    max_norm = 9.85
    # 列向量测试
    # input_x = np.random.uniform(1, 2, [256, 8]).astype(np.float16)
    # dim = 1
    # p = 3.0
    # max_norm = 9.85
    
    input_x_torch = torch.from_numpy(input_x)
    # print(input_x_torch)
    golden = torch.renorm(input_x_torch, p=p, maxnorm=max_norm, dim=dim).numpy().astype(np.float16)
    input_x.tofile("./input/input_x.bin")
    golden.tofile("./output/golden.bin")


if __name__ == "__main__":
    gen_golden_data_simple()
